package dynamicproxy;

import dynamicproxy.Car;
import dynamicproxy.Vehicle;
import practise.dynamicproxy.VehicleInvocationHandler;

import java.lang.reflect.Proxy;

/**
 * @author: 默苍璃
 * @date: 2023-01-10 15:35
 */
public class App {
    public static void main(String[] args) {
        Vehicle car = new Car();

        Vehicle vehicle = (Vehicle) Proxy.newProxyInstance(car.getClass().getClassLoader(),
                Car.class.getInterfaces(), new VehicleInvocationHandler(car));
        vehicle.run();
        vehicle.run1();
    }

}
